<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 
      自定义属性取名： 连字符
      自定义属性接受： 小驼峰
     -->
    <div id="app">
      <h3>props</h3>
      <child
        name="juner"
        :age="40"
        :weight="160"
        :likes="[299,399,699]"
        :obj="obj"
      ></child>
    </div>

    <script src="../Vue.js"></script>
    <script>
      const Child = {
        // props: ["name", "age", "weight"],

        // props可以使用对象的写法，可以帮助我们约定props的类型
        props: {
          name: String,
          age: Number,
          weight: Number,
          likes: Array,
          obj: Object,
        },
        template: `
          <div>child组件 - {{ name }}的年龄是{{ age }}岁，他重{{ weight }}kg, 他的爱好是{{ likes }}, {{obj.a}}</div>
        `,
      };
      new Vue({
        el: "#app",
        data: {
          obj: {
            a: 3,
            b: 4,
          },
        },
        components: {
          Child,
        },
      });
    </script>
  </body>
</html>
